<template>
  <div>
    <a-row>
      <a-col :span="5">
        <a-card>
          <p>尿液检测</p>
          <a-row v-if="Urinedata != null">
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata.shouldNum }}</span>次</p>
              <p class="p1">应检测</p>
              <!-- <p class="p1">111{{ jsonParam }}</p> -->
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata.actualNum }}</span>次</p>
              <p class="p1">实检测</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata.exemptNum }}</span>次</p>
              <p class="p1">免除</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata.cancelNum }}</span>次</p>
              <p class="p1">取消</p>
            </a-col>
            <a-col :span="4" style="width: 24%;margin-right: 0;">
              <p class="p1"><span>{{ Urinedata.ratio }}</span></p>
              <p class="p1">平均完成率</p>
            </a-col>
          </a-row>
          <a-row v-else></a-row>
        </a-card>
      </a-col>
      <a-col :span="5">
        <a-card>
          <p>毛发检测</p>
          <a-row v-if="Urinedata1 != null">
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata1.shouldNum }}</span>次</p>
              <p class="p1">应检测</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata1.actualNum }}</span>次</p>
              <p class="p1">实检测</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata1.exemptNum }}</span>次</p>
              <p class="p1">免除</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Urinedata1.cancelNum }}</span>次</p>
              <p class="p1">取消</p>
            </a-col>
            <a-col :span="4" style="width: 24%;margin-right: 0;">
              <p class="p1"><span>{{ Urinedata1.ratio }}</span></p>
              <p class="p1">平均完成率</p>
            </a-col>
          </a-row>
          <a-row v-else></a-row>
        </a-card>
      </a-col>
      <a-col :span="5">
        <a-card>
          <p>定期访谈</p>
          <a-row v-if="Interviewdata != null">
            <a-col :span="4">
              <p class="p1"><span>{{ Interviewdata.shouldNum }}</span>次</p>
              <p class="p1">应访谈</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Interviewdata.actualNum }}</span>次</p>
              <p class="p1">实访谈</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Interviewdata.exemptNum }}</span>次</p>
              <p class="p1">免除</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Interviewdata.acancelNum4 }}</span>次</p>
              <p class="p1">取消</p>
            </a-col>
            <a-col :span="4" style="width: 24%;margin-right: 0;">
              <p class="p1"><span>{{ Interviewdata.ratio }}</span></p>
              <p class="p1">平均完成率</p>
            </a-col>
          </a-row>
          <a-row v-else></a-row>
        </a-card>
      </a-col>
      <a-col :span="5" style="margin-right: 0;">
        <a-card>
          <p>定期报告</p>
          <a-row v-if="Reportdata != null">
            <a-col :span="4">
              <p class="p1"><span>{{ Reportdata.shouldNum }}</span>次</p>
              <p class="p1">应报告</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Reportdata.actualNum }}</span>次</p>
              <p class="p1">实报告</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ Reportdata.cancelNum }}</span>次</p>
              <p class="p1">取消</p>
            </a-col>
            <a-col :span="4" style="width: 24%;margin-right: 0;">
              <p class="p1"><span>{{ Reportdata.ratio }}</span></p>
              <p class="p1">平均完成率</p>
            </a-col>
          </a-row>
          <a-row v-else></a-row>
        </a-card>
      </a-col>
    </a-row>
    <a-row>
      <a-col :span="5" style="margin-top:15px;">
        <a-card>
          <p>签到</p>
          <a-row v-if="SignCountdata != null">
            <a-col :span="4">
              <p class="p1">
                <span>{{ SignCountdata.shouldMonthSignInDays }}</span>次
              </p>
              <p class="p1">应签到</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ SignCountdata.actMonthSignInDays }}</span>次</p>
              <p class="p1">实签到</p>
            </a-col>
            <a-col :span="4">
              <p class="p1"><span>{{ SignCountdata.exemptionDays }}</span>次</p>
              <p class="p1">免除</p>
            </a-col>
            <!-- <a-col :span="4">
              <p class="p1"><span>{{ SignCountdata.missSignInDays }}</span>次</p>
              <p class="p1">取消</p>
            </a-col> -->
            <a-col :span="4" style="width: 24%;margin-right: 0;">
              <p class="p1"><span>{{ SignCountdata.signInRate }}</span></p>
              <p class="p1">平均签到率</p>
            </a-col>
          </a-row>
          <a-row v-else></a-row>
        </a-card>
      </a-col>
      <a-col :span="17" style="margin-top:15px;width: 74.3%;">
        <a-card v-if="Otherdata != null">
          <p>其它介入情况</p>
          <p class="p2">请假次数 <span class="s1">{{ Otherdata.leaveNum }}</span> 次；请假时长 <span class="s1">{{
            Otherdata.leaveTime
          }}</span>
            天能；接受救助帮扶 <span class="s1">{{ Otherdata.helpNum }}</span> 次；接受帮教谈心 <span class="s1">{{
              Otherdata.interviewNum
            }}</span> 次；接受心理咨询
            <span class="s1">{{ Otherdata.mentalityNum }}</span>
            次；接受法律援助 <span class="s1">{{ Otherdata.lawNum }}</span> 次；申请职业技能培训 <span class="s1">{{
              Otherdata.applyTrainNum
            }}</span> 次；参与职业技能培训
            <span class="s1">{{ Otherdata.joinTrainNum }}</span> 次；
            提交就业意愿 <span class="s1">{{ Otherdata.submitAspirationNum }}</span> 次；就业安置 <span class="s1">{{
              Otherdata.placementNum
            }}</span> 次；参与社区活动 <span class="s1">{{
  Otherdata.communityActiveNum
}}</span> 次；参与小组活动 <span class="s1">{{ Otherdata.groupActiveNum }}</span> 次；服药 <span class="s1">{{
  Otherdata.takeMedicineNum
}}</span> 次；
          </p>
        </a-card>
        <a-card v-else></a-card>
      </a-col>
    </a-row>
  </div>
</template>

<script>

export default {
  props: {
    businessType: {
      type: [String, Number],
      required: 0
    },
    jsonParam: {
      type: Object
    },
  },
  data() {
    return {
      Urinedata: {},
      Interviewdata: {},
      Reportdata: {},
      Otherdata: {},
      Urinedata1: {},
      SignCountdata: {},
      loading: false,
    }
  },
  watch: {
    businessType: {
      immediate: true,
      deep: true,
      handler(val) {
        // console.log(this.businessType);
      }
    },
    jsonParam: {
      immediate: true,
      deep: true,
      handler(val) {
        // this.Urinedata = val.urineTest?val.urineTest:val.Urinedata
        // this.Urinedata1 = val.hairDetection?val.urineTest:val.Urinedata1
        // this.Otherdata = val.otherInterventions?val.urineTest:val.Otherdata
        // this.SignCountdata = val.sign?val.urineTest:val.SignCountdata
        // this.Reportdata = val.periodicReport?val.urineTest:val.Reportdata
        // this.Interviewdata = val.regularInterviews?val.urineTest:val.Interviewdata
        if (val.urineTest) {
          let a = val.urineTest.split(',')
          this.Urinedata = {}
          a.forEach(item => {
            let b = item.split(':')
            this.Urinedata[b[0]] = b[1]
          })
          // console.log(this.Urinedata);
        }
        else {
          this.Urinedata = val.Urinedata
        }

        if (val.hairTest) {
          let bb = val.hairTest.split(',')
          this.Urinedata1 = {}
          bb.forEach(item => {
            let b = item.split(':')
            this.Urinedata1[b[0]] = b[1]
          })
        }
        else {
          if(val.hairDetection){
          let bb = val.hairDetection.split(',')
          this.Urinedata1 = {}
          bb.forEach(item => {
            let b = item.split(':')
            this.Urinedata1[b[0]] = b[1]
          })
          }
          else{
            this.Urinedata1 = val.Urinedata1
          }
        }

        if (val.otherIntervent) {
          let c = val.otherIntervent.split(',')
          this.Otherdata = {}
          c.forEach(item => {
            let b = item.split(':')
            this.Otherdata[b[0]] = b[1]
          })
        }
        // else if (val.Otherdata) {
        //   this.Otherdata = val.Otherdata
        // }
        else {
         if(val.otherInterventions){
          let c = val.otherInterventions.split(',')
          this.Otherdata = {}
          c.forEach(item => {
            let b = item.split(':')
            this.Otherdata[b[0]] = b[1]
          })
         }
         else{
          this.Otherdata = val.Otherdata
          }
        }
        
        if (val.signIn) {
          let d = val.signIn.split(',')
          this.SignCountdata = {}
          d.forEach(item => {
            let b = item.split(':')
            this.SignCountdata[b[0]] = b[1]
          })
        }
        else if (val.sign) {
          let d = val.sign.split(',')
          this.SignCountdata = {}
          d.forEach(item => {
            let b = item.split(':')
            this.SignCountdata[b[0]] = b[1]
          })
        }
        else {
          this.SignCountdata = val.SignCountdata
        }

        if (val.periodicReport) {
          let e = val.periodicReport.split(',')
          this.Reportdata = {}
          e.forEach(item => {
            let b = item.split(':')
            this.Reportdata[b[0]] = b[1]
          })
        }
        else {
          this.Reportdata = val.Reportdata
        }
        if (val.regularInterviews) {
          let f = val.regularInterviews.split(',')
          this.Interviewdata = {}
          f.forEach(item => {
            let b = item.split(':')
            this.Interviewdata[b[0]] = b[1]
          })
        }
        else {
          this.Interviewdata = val.Interviewdata
        }
      }
    }

  },
  created() {
    // this.jsonParam = {}
  },
  async mounted() {

  },

  methods: {

    getData1() {
      let obj = {
        shouldNum: this.Urinedata.shouldNum,
        actualNum: this.Urinedata.actualNum,
        exemptNum: this.Urinedata.exemptNum,
        cancelNum: this.Urinedata.cancelNum,
        ratio: this.Urinedata.ratio
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    },
    getData2() {
      let obj = {
        shouldNum: this.Urinedata1.shouldNum,
        actualNum: this.Urinedata1.actualNum,
        exemptNum: this.Urinedata1.exemptNum,
        cancelNum: this.Urinedata1.cancelNum,
        ratio: this.Urinedata1.ratio
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号，否则带反斜杠
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    },
    getData3() {
      let obj = {
        shouldNum: this.Interviewdata.shouldNum,
        actualNum: this.Interviewdata.actualNum,
        exemptNum: this.Interviewdata.exemptNum,
        acancelNum4: this.Interviewdata.cancelNum,
        ratio: this.Interviewdata.ratio
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号，否则带反斜杠
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    },
    getData4() {
      let obj = {
        shouldNum: this.Reportdata.shouldNum,
        actualNum: this.Reportdata.actualNum,
        exemptNum: this.Reportdata.exemptNum,
        cancelNum: this.Reportdata.cancelNum,
        ratio: this.Reportdata.ratio
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号，否则带反斜杠
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    },
    getData5() {
      let obj = {
        shouldMonthSignInDays: this.SignCountdata.shouldMonthSignInDays,
        actMonthSignInDays: this.SignCountdata.actMonthSignInDays,
        exemptionDays: this.SignCountdata.exemptionDays,
        // missSignInDays: this.SignCountdata.missSignInDays,
        signInRate: this.SignCountdata.signInRate
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号，否则带反斜杠
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    },
    getData6() {
      let obj = {
        leaveNum: this.Otherdata.leaveNum,
        leaveTime: this.Otherdata.leaveTime,
        helpNum: this.Otherdata.helpNum,
        interviewNum: this.Otherdata.interviewNum,
        mentalityNum: this.Otherdata.mentalityNum,
        lawNum: this.Otherdata.lawNum,
        applyTrainNum: this.Otherdata.applyTrainNum,
        joinTrainNum: this.Otherdata.joinTrainNum,
        submitAspirationNum: this.Otherdata.submitAspirationNum,
        placementNum: this.Otherdata.placementNum,
        communityActiveNum: this.Otherdata.communityActiveNum,
        groupActiveNum: this.Otherdata.groupActiveNum,
        takeMedicineNum: this.Otherdata.takeMedicineNum,
      }
      let str = ""
      let objStr = JSON.stringify(obj).replace(/\"/g, "")//去掉双引号，否则带反斜杠
      str = objStr.substr(1) //删除第一个字符
      str = str.substr(0, str.length - 1) //删除最后一个字符
      return str
    }
  },
}
</script>
<style lang="less" scoped>
/deep/.ant-col-5 {
  width: 24%;
  margin-right: 1.2%;
}

/deep/.ant-col-4 {
  width: 14.5%;
  margin-right: 4.5%;
}

/deep/.ant-card-body {
  padding: 10px;
}

.p1 {
  margin: 0;
  font-size: 12px;

  span {
    font-size: 18px;
  }
}

.p2 {
  margin-bottom: 0;

  line-height: 21.5px;

  // font-size: 12px;
  .s1 {
    color: #1890FF;
    font-size: 16px;
  }
}
</style>



